package com.citycloud.ccuap.tc.admin.project;

import com.citycloud.ccuap.commons.db.LikeMatchMode;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Version;
import org.springframework.data.mybatis.annotations.Column;
import org.springframework.data.mybatis.annotations.Condition;
import org.springframework.data.mybatis.annotations.Conditions;
import org.springframework.data.mybatis.annotations.Id;
import org.springframework.data.repository.query.parser.Part;

import java.util.Date;

@Data
@NoArgsConstructor
public class SysProjectDto {
    @Id(strategy = Id.GenerationType.AUTO)
    @Column(name = "obj_id")
    @Condition
    private Long objId;

    @Column(name = "project_id")
    @Condition
    private Long projectId;

    /**
     * 应用类型，0-web应用，1-app应用
     */
    @Column(name = "app_type")
    @Condition
    private Integer appType;

    /**
     * 站点类型名称
     */
    @Column(name = "project_typeId")
    @Condition
    private String projectTypeId;

    @Column(name = "client_id")
    @Condition
    private String clientId;


    @Column(name = "cat_id")
    @Condition
    private Long catId;

    @Column(name = "project_no")
    @Condition(type = Part.Type.LIKE)
    private String projectNo;

    @Column(name = "project_name")
    @Condition(type = Part.Type.LIKE,likeMatchMode= LikeMatchMode.BOTHADD)
    private String projectName;

    @Column(name = "url")
    @Condition(type = Part.Type.LIKE)
    private String url;

    @Column(name = "manager_id")
    @Condition
    private Long managerId;

    @Column(name = "manager_name")
    @Condition(type = Part.Type.LIKE)
    private String managerName;

    @Column(name = "manager_ids")
    @Condition(type = Part.Type.LIKE)
    private String managerIds;

    @Column(name = "manager_names")
    @Condition(type = Part.Type.LIKE,likeMatchMode=LikeMatchMode.BOTHADD)
    private String managerNames;

    @Column(name = "icon_path")
    @Condition(type = Part.Type.LIKE)
    private String iconPath;

    @Column(name = "background_path")
    @Condition(type = Part.Type.LIKE)
    private String backgroundPath;

    @Column(name = "data_status")
    @Condition
    private Short dataStatus;

    @Column(name = "seq")
    @Condition
    private Integer seq;

    @Column(name = "deleted")
    @Condition
    private Boolean deleted;

    @Version
    @Column(name = "version")
    @Condition
    private Integer version;

    @Column(name = "datagroups")
    @Condition(type = Part.Type.LIKE)
    private String datagroups;

    @Column(name = "creator")
    @Condition(type = Part.Type.LIKE)
    private String creator;

    @Column(name = "created_time")
    @Conditions({
            @Condition,
            @Condition(type = Part.Type.GREATER_THAN_EQUAL, properties="startCreatedTime"),
            @Condition(type = Part.Type.LESS_THAN, properties="endCreatedTime")
    })
    private Date createdTime;

    @Column(name = "updator")
    @Condition(type = Part.Type.LIKE)
    private String updator;

    @Column(name = "updated_time")
    @Conditions({
            @Condition,
            @Condition(type = Part.Type.GREATER_THAN_EQUAL, properties="startUpdatedTime"),
            @Condition(type = Part.Type.LESS_THAN, properties="endUpdatedTime")
    })
    private Date updatedTime;

    @Column(name = "remark")
    @Condition(type = Part.Type.LIKE)
    private String remark;

    /**
     * 数据区域（0为不区分，1为vpn1区，2为vpn2区）
     */
    @Column(name = "environment_flag")
    @Condition
    private String environmentFlag;
    /**
     * MQ 开关（0：关，1：开）
     */
    @Column(name = "mq_off")
    @Condition
    private Boolean mqOff;
}
